package com.sina.finance.api.sdk;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.TimeZone;

public class ApiHashMap extends HashMap<String, String> {
    private static final long serialVersionUID = -1277791390393392630L;

    public ApiHashMap() {
    }

    public ApiHashMap(Map<? extends String, ? extends String> paramMap) {
        super(paramMap);
    }

    public String put(String paramString, Object paramObject) {
        String str;
        if (paramObject == null) {
            str = null;
        } else if ((paramObject instanceof String)) {
            str = (String) paramObject;
        } else if ((paramObject instanceof Integer)) {
            str = ((Integer) paramObject).toString();
        } else if ((paramObject instanceof Long)) {
            str = ((Long) paramObject).toString();
        } else if ((paramObject instanceof Float)) {
            str = ((Float) paramObject).toString();
        } else if ((paramObject instanceof Double)) {
            str = ((Double) paramObject).toString();
        } else if ((paramObject instanceof Boolean)) {
            str = ((Boolean) paramObject).toString();
        } else if ((paramObject instanceof Date)) {
            SimpleDateFormat localSimpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            localSimpleDateFormat.setTimeZone(TimeZone.getTimeZone("GMT+8"));
            str = localSimpleDateFormat.format((Date) paramObject);
        } else {
            str = paramObject.toString();
        }

        return put(paramString, str);
    }

    public String put(String paramString1, String paramString2) {
        if (StringUtils.areNotEmpty(new String[]{paramString1, paramString2})) {
            return (String) super.put(paramString1, paramString2);
        }
        return null;
    }
}

